
function checkListFinalized(elem){
	var name = elem.getAttribute("checklist");
	alert("A lista de verificação "+name+" já foi finalizada, não é mais possível alterar dados na mesma");
}

function loadData(){
	var xmlData = "<?xml version=\"1.0\"?>";
	
	xmlData += "<ROOT>";
	xmlData += "<FORM value=\""+FORM+"\"> </FORM>";
	xmlData += "<ACTION value=\"SELECT\"></ACTION>";
	xmlData += "</ROOT>";
    var conn = new ClientConnector();
	
	conn.setCallBack(function(code){
		eval(code);
	});
	
	conn.send(xmlData);
}


function logout(){
	var xmlData = "<?xml version=\"1.0\"?>";
	
	xmlData += "<ROOT>";
	xmlData += "<FORM value=\""+FORM+"\"> </FORM>";
	xmlData += "<ACTION value=\"LOGOUT\"></ACTION>";
	xmlData += "</ROOT>";
    var conn = new ClientConnector();
	
	conn.setCallBack(function(code){
		eval(code);
	});
	
	conn.send(xmlData);
}


function openChecklistDef(elem){
	
	var xmlData = "<?xml version=\"1.0\"?>";
	
	xmlData += "<ROOT>";
	xmlData += "<FORM value=\""+FORM+"\"> </FORM>";
	xmlData += "<ACTION value=\"EXECUTE\"></ACTION>";
	xmlData += "<CHECK_LIST_NAME value=\""+elem.getAttribute("checklist")+"\"></CHECK_LIST_NAME>";
	xmlData += "</ROOT>";
    var conn = new ClientConnector();
	
	conn.setCallBack(function(code){
		eval(code);
	});
	
	conn.send(xmlData);
}

function doReport(elem){
	
	var url = "http://" + window.location.host + "/baker-street-web/MainServlet?checklist="+elem.getAttribute("checklist");
	window.open(url);
	
	/*var xmlData = "<?xml version=\"1.0\"?>";
	
	xmlData += "<ROOT>";
	xmlData += "<FORM value=\""+FORM+"\"> </FORM>";
	xmlData += "<ACTION value=\"REPORT\"></ACTION>";
	xmlData += "<CHECK_LIST_NAME value=\""+elem.getAttribute("checklist")+"\"></CHECK_LIST_NAME>";
	xmlData += "</ROOT>";
    
	var conn = new ClientConnector();
	conn.setMethod("GET");
	conn.send(xmlData); */	
}

function controlUser(){
	var lbUserName = getById("user-name");
	var lbUserLogin = getById("user-login");
	var lbUserType = getById("user-type");
	
	lbUserName.innerHTML = user.name;
	lbUserLogin.innerHTML = user.login;
	lbUserType.innerHTML = user.type;
	
	
	if (user.type == "ADMINISTRADOR"){
		var ct = getById("admin-options");
		ct.style.display = "inline";
	}
	
}

function noCheckListAvailable(elem){
	alert("O checkList "+elem.getAttribute("checklist")+" ainda n�o foi iniciado");
}

